import router from '@system.router';
import Fetch from '@system.fetch';

export default {
    data: {
        percent: 40,
        secondaryPercent: 100,
        dir: 1,
        list:[
            {
                name:"状态监测",
                uri: 'pages/status/status',
            },
            {
                name:"倒计时",
                uri: 'pages/countDown/index',
            },
            {
                name:"倒计时",
                uri: 'pages/countDown/index',
                last:true
            }
        ]
    },
    onInit() {

        // Fetch.fetch({
        //     url:'http://localhost:3002/graph我来啦',
        //     success:(res) => {
        //         console.log(Object.keys(res))
        //         console.log(res)
        //     },
        //     fail:(data, code) => {
        //         console.log("请求 失败",code)
        //     },
        //     complete:() => {
        //         console.log("complete")
        //     },
        //     header:{
        //         'Content-Type':'application/x-www-form-urlencoded;charset=utf-8'
        //     },
        //     method:'GET'
        // })

    },
    onShow() {
    },
    to(item){
        console.log(item.uri)
        router.push({
            uri: item.uri,
        });
    },
    toCountDown() {
        console.log('to countDown page')
        router.push({
            uri: 'pages/countDown/index',
        });
    },
    toStatusMonitor() {
        router.push({
            uri: 'pages/status/status',
        });
    },
    animation() {
        this.handleFrame = setTimeout(() => this.animation(),500);
        this.percent  = Math.random() * 100;
        this.secondaryPercent  = Math.random() * 100;
    }
}